package cn.kshost.zqyg.client.product;

import cn.kshost.zqyg.client.product.fallback.ProductFeignFallback;
import cn.kshost.zqyg.model.dto.product.SkuSaleDto;
import cn.kshost.zqyg.model.entity.product.ProductSku;
import cn.kshost.zqyg.model.vo.common.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "service-product",fallback = ProductFeignFallback.class)
public interface ProductFeign {

    @GetMapping("/api/product/getBySkuId/{skuId}")
    Result<ProductSku> getBySkuId(@PathVariable("skuId") Long skuId);

    @PostMapping("/api/product/updateSkuSaleNum")
    Boolean updateSkuSaleNumAndStock(@RequestBody List<SkuSaleDto> skuSaleDtos);
}